﻿@using LanguageExt
@using static LanguageExt.Prelude;
@page "/counter"
@rendermode InteractiveServer

<PageTitle>Counter</PageTitle>

<h1>Counter</h1>

<p role="status">Current count: @currentCount</p>

<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>

@code {
    Atom<int> currentCount = Atom(0);

    void IncrementCount() =>
        incrementCount.Run();

    IO<int> incrementCount =>
        currentCount.SwapIO(x => x + 1);
}